package com.example.back.dao.pay;

import com.example.back.bean.pay.UserPayInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.Date;
import java.util.Map;

@Mapper
public interface PayOrderInfoDao {
    @Select("select count(*) from p_pay_order where orderId=#{orderId}")
    int getPayOrderInfo(String orderId);

    @Select("insert into p_pay_order(userId,orderId,amount,status,type,createTime,details,userName,number)values(#{userId},#{orderId},#{amount},#{status},#{type},#{createTime},#{details},#{userName},#{number})")
    void insertPayOrderInfo(UserPayInfo userPayInfo);

    @Select("select * from p_pay_order where orderId=#{orderId} and createTime between #{beginTime} and #{endTime} and status = 0 limit 1")
    UserPayInfo selectPayOrderInfo(String orderId,String beginTime,String endTime);

    @Update("update p_pay_order set status=#{status},billno=#{billno} where id=#{id}")
    int updatePayOrderInfo(UserPayInfo userPayInfo);

}
